import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import MyFilm from "../views/MyFilm.vue";
import MyCinema from "../views/MyCinema.vue";
import MyNews from "../views/MyNews.vue";
import MyCenter from '../views/MyCenter.vue'
import ComingSoon from '../views/ComingSoon.vue'
import NowPlaying from '../views/NowPlaying.vue'

// RouteRecordRaw 路由一行记录的约束规则
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect:'/film'
  },{
    path:'/film',
    name:'film',
    component:MyFilm,
    redirect:'/film/nowplaying',
    children: [
      {
        path:'nowplaying',
        component:NowPlaying
      },{
        path:'comingsoon',
        component:ComingSoon
      }
    ]
  },{
    path:'/cinema',
    name:'cinema',
    component:MyCinema
  },{
    path:'/news',
    name:'news',
    component:MyNews
  },{
    path:'/center',
    name:'center',
    component:MyCenter
  }

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
